package Demo06;

import java.util.ArrayList;

public class ArrayListStudent {
    public static void main(String[] args) {
        ArrayList<Student> list = new ArrayList<>();
        Student one = new Student("多多",20);
        Student two = new Student("小小",26);
        Student three = new Student("嘿嘿",18);
        Student four = new Student("哈哈",21);
        list.add(one);
        list.add(two);
        list.add(three);
        list.add(four);
        for (int i = 0; i <list.size() ; i++) {
            Student stu = list.get(i);
            System.out.println("姓名" + stu.getName() + ", 年龄" + stu.getAge());

        }
    }
}
